//
//  AdoptDetailsCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/9/6.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "AdoptDetailsCell.h"

@implementation AdoptDetailsCell

#pragma mark - lifecycle methods
- (void)setupUI{
    
    [self addSubview:self.nameLab];
    [self addSubview:self.priceLab];
    [self addSubview:self.dayLab];
    
}

- (void)setupLayout{
    
    CGFloat width = (KScreenWidth - 33)/3.0;
    {
        _nameLab.size = _priceLab.size = _dayLab.size = CGSizeMake(width, 44);
        _nameLab.mj_y = _priceLab.mj_y = _dayLab.mj_y = 0;
        _nameLab.mj_x = 15;
        _priceLab.mj_x = _nameLab.right + 1;
        _dayLab.mj_x = _priceLab.right + 1;
    }
}

#pragma mark - setter methods
- (void)setBgColor:(UIColor *)bgColor{
    
    _nameLab.backgroundColor = _dayLab.backgroundColor = _priceLab.backgroundColor = bgColor;
}

- (void)setItem:(AdoptDetail *)item{
    
    _nameLab.text = item.name;
    _priceLab.text = [NSString stringWithFormat:@"%@元", item.money];
    _dayLab.text = [NSString stringWithFormat:@"%@天", item.day];
}

#pragma mark - getter methods

- (UILabel *)nameLab{
    
    if (!_nameLab) {
        _nameLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x828282) font:mFont(13) textAliment:1];
    }
    return _nameLab;
}

- (UILabel *)priceLab{
    
    if (!_priceLab) {
        _priceLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x828282) font:mFont(13) textAliment:1];
    }
    return _priceLab;
}

- (UILabel *)dayLab{
    
    if (!_dayLab) {
        _dayLab = [UILabel makeLabelWithText:@"" textColor:UIColorFromRGB(0x828282) font:mFont(13) textAliment:1];
    }
    return _dayLab;
}

@end
